<?php
	DEFINE('H1', 'Test MySQL');
	DEFINE('TITLE','Test MySQL');
	require('includes/header.php');
?>	
	<h2><?PHP echo H1 ?></h2>

<?php
	require_once ('db/DBParms.php');
	
	$mysqli = new  mysqli(DBHOST, DBUSER, DBPWD, "music");

	if($mysqli === false) 
		{ die("Error: Cannot access " . DBHOST . " for user " . DBUSER);
		}
	
	$sql = "Select artist_id, artist_name from artists";
	
	if ($result = $mysqli->query($sql))
		{
		if($result->num_rows > 0) 
			{ 
?>
	<h2>My Musical Artists</h2>
	<ul>
	
<?php
		while($row = $result->fetch_array()) 
			{ echo "<li>" . $row[0] . ":" . $row[1] . "</li>\n";
			}
			$result->close();
			} else {
			echo "No records matching your query were found.";
			}
		} else {
			echo "ERROR: Could not execute $sql. " . $mysqli->error;
	}
	echo "</ul>";
	$mysqli->close();
?>


<?php
	require('includes/footer.php');
?>